package com.by.config;

import com.by.interceptor.TokenValidIntercepor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig implements WebMvcConfigurer {

    //拦截器注册
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println("拦截器注册");
        registry.addInterceptor(new TokenValidIntercepor())//new AuthInterceptor()//new TokenValidIntercepor()
                .addPathPatterns("/api/**")  // 拦截以/api开头的所有请求
        ;
    }
}
